<?php

/**
 * Created by PhpStorm.
 * Author: ls
 * Time: 2023/8/17 17:36
 * Desc: 线路产品参数验证
 */
class Request_Api_V2_Line extends Request_Api_V2_Base
{
    public function __construct($request_param)
    {
        parent::__construct($request_param);
    }

    public function get_detail()
    {
        $this->rules = [
            ['id', ['not_empty', 'digit', $this->rule_min(1)]],
        ];

        return $this;
    }

    public function contract()
    {
        $this->rules = [
            ['id', ['not_empty', 'digit']],
        ];

        return $this;
    }

    public function get_index_recommend()
    {
        $this->rules = [
            ['page', ['digit', $this->rule_min(1)]],
            ['pagesize', ['digit', $this->rule_min(1)]],
        ];

        return $this;
    }

    public function general_query()
    {
        $this->rules = [
            ['page', ['digit', $this->rule_min(1)]],
            ['pagesize', ['digit', $this->rule_min(1)]],
            ['day_id', ['digit']],
            ['price_id', ['digit']],
            ['sort_type', ['digit']],
            ['start_city_id', ['digit']],
        ];

        return $this;
    }

    public function get_dest_list()
    {
        $this->rules = [
                ['dest_id', ['not_empty', 'digit']],
            ['page', ['not_empty', 'digit', $this->rule_min(1)]],
            ['pagesize', ['not_empty', 'digit', $this->rule_min(1)]],
        ];

        return $this;
    }

    public function get_suit_list()
    {
        $this->rules = [
            ['line_id', ['not_empty']],
            ['suit_id', ['not_empty']],
            ['is_seckill', ['digit']],
            ['card_suit_id', ['digit']],
            ['together_id', ['digit']],
        ];

        return $this;
    }

    public function get_line_title()
    {
        $this->rules = [
            ['productid', ['not_empty', 'digit']]
        ];

        return $this;
    }

    public function get_price_calendar_json()
    {
        $this->rules = [
            ['suit_id', ['not_empty', 'digit']],
            ['product_id', ['digit']],
            ['together_id', ['digit']],
            ['is_seckill', ['digit']],
        ];

        return $this;
    }

    public function add_order()
    {
        //自定义规则
        $this->validation->rule('mid',array('Rule_Member','need_member'));

        $this->rules = [
            ['product_id', ['not_empty', 'digit']],
            ['suit_id', ['not_empty', 'digit']],
            ['dingnum', ['digit']],
            ['childnum', ['digit']],
            ['oldnum', ['digit']],
            ['people4num', ['digit']],
            ['people5num', ['digit']],
            ['people6num', ['digit']],
            ['roombalancenum', ['digit']],
            ['linkman', ['not_empty']],
            ['linktel', ['not_empty', 'phone']],
            ['linkemail', ['email']],
            ['use_date', ['not_empty', $this->rule_date_format('Y-m-d')]],
            ['together_id', ['digit']],
            ['join_id', ['digit']],
            ['seckill_id', ['digit']],
        ];

        return $this;
    }

    public function get_index_hot_dest()
    {
        $this->rules = [
            ['page', ['digit', $this->rule_min(1)]],
            ['pagesize', ['digit', $this->rule_min(1)]],
        ];

        return $this;
    }
}